home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / beveled-pattern-heading.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  4.0 KB  |  121 lines

  1. ; GIMP - The GNU Image Manipulation Program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; Beveled pattern heading for web pages
  5. ; Copyright (C) 1997 Federico Mena Quintero
  6. ; federico@nuclecu.unam.mx
  7. ;
  8. ; This program is free software: you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 3 of the License, or
  11. ; (at your option) any later version.
  12. ;
  13. ; This program is distributed in the hope that it will be useful,
  14. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ; GNU General Public License for more details.
  17. ;
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  20. ; ************************************************************************
  21. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  22. ; For use with GIMP 1.1.
  23. ; All calls to gimp-text-* have been converted to use the *-fontname form.
  24. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  25. ; ************************************************************************
  26.  
  27.  
  28. (define (script-fu-beveled-pattern-heading
  29.          text text-size font pattern transparent)
  30.   (let* (
  31.         (img (car (gimp-image-new 10 10 RGB)))
  32.         (textl
  33.           (car
  34.             (gimp-text-fontname img -1 0 0 text 0 TRUE text-size PIXELS font)))
  35.  
  36.         (width (car (gimp-drawable-width textl)))
  37.         (height (car (gimp-drawable-height textl)))
  38.  
  39.         (background (car (gimp-layer-new img
  40.                                          width height RGBA-IMAGE
  41.                                          "Background" 100 NORMAL-MODE)))
  42.         (bumpmap (car (gimp-layer-new img
  43.                                       width height RGBA-IMAGE
  44.                                       "Bumpmap" 100 NORMAL-MODE)))
  45.         )
  46.  
  47.     (gimp-context-push)
  48.  
  49.     (gimp-image-undo-disable img)
  50.     (gimp-image-resize img width height 0 0)
  51.     (gimp-image-add-layer img background 1)
  52.     (gimp-image-add-layer img bumpmap 1)
  53.  
  54.     ; Create pattern layer
  55.  
  56.     (gimp-context-set-background '(0 0 0))
  57.     (gimp-edit-fill background BACKGROUND-FILL)
  58.     (gimp-context-set-pattern pattern)
  59.     (gimp-edit-bucket-fill background
  60.                            PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  61.  
  62.     ; Create bumpmap layer
  63.  
  64.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  65.  
  66.     (gimp-context-set-background '(127 127 127))
  67.     (gimp-selection-layer-alpha textl)
  68.     (gimp-selection-shrink img 1)
  69.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  70.  
  71.     (gimp-context-set-background '(255 255 255))
  72.     (gimp-selection-layer-alpha textl)
  73.     (gimp-selection-shrink img 2)
  74.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  75.  
  76.     (gimp-selection-none img)
  77.  
  78.     ; Bumpmap
  79.  
  80.     (plug-in-bump-map RUN-NONINTERACTIVE img background bumpmap 135 45 2 0 0 0 0 TRUE FALSE 0)
  81.  
  82.     ; Clean up
  83.  
  84.     (gimp-context-set-background '(0 0 0))
  85.     (gimp-selection-layer-alpha textl)
  86.     (gimp-selection-invert img)
  87.     (gimp-edit-clear background)
  88.     (gimp-selection-none img)
  89.  
  90.     (gimp-image-set-active-layer img background)
  91.     (gimp-image-remove-layer img bumpmap)
  92.     (gimp-image-remove-layer img textl)
  93.  
  94.     (if (= transparent FALSE)
  95.         (gimp-image-flatten img))
  96.  
  97.     (gimp-image-undo-enable img)
  98.     (gimp-display-new img)
  99.  
  100.     (gimp-context-pop)
  101.   )
  102. )
  103.  
  104.  
  105. (script-fu-register "script-fu-beveled-pattern-heading"
  106.   _"H_eading..."
  107.   _"Create a beveled pattern heading for webpages"
  108.   "Federico Mena Quintero"
  109.   "Federico Mena Quintero"
  110.   "July 1997"
  111.   ""
  112.   SF-STRING     _"Text"               "Hello world!"
  113.   SF-ADJUSTMENT _"Font size (pixels)" '(72 2 200 1 1 0 1)
  114.   SF-FONT       _"Font"               "Sans"
  115.   SF-PATTERN    _"Pattern"            "Wood"
  116.   SF-TOGGLE     _"Transparent background" FALSE
  117. )
  118.  
  119. (script-fu-menu-register "script-fu-beveled-pattern-heading"
  120.                          "<Image>/File/Create/Web Page Themes/Beveled Pattern")
  121.